package com.jason.campusinn.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;

/**
 * 自定义固定高度的ListView
 * @author Administrator
 *
 */
public class FixedGridView extends GridView {

	public FixedGridView(Context context) {
		this(context, null);
	}

	public FixedGridView(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public FixedGridView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	/**
	 * 设置list不能滚动 直接显示所有item
	 */
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
				MeasureSpec.AT_MOST);
		super.onMeasure(widthMeasureSpec, expandSpec);
	}
}
